﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Configuration;
using Senparc.Weixin.MP.CommonAPIs;
using Senparc.Weixin.MP.AdvancedAPIs.Media;

namespace ShareMarking.Service.Web.weixin
{
    public partial class weixinJSSDK : JSSDKHelp
    {
        public long timestamp;//生成签名的时间戳
        public string nonceStr;//生成签名的随机串
        public string signature;//签名
        public string jstick;
        public string str;
        private string appId = WebConfigurationManager.AppSettings["WeixinAppId"];
        private string appSecret = WebConfigurationManager.AppSettings["WeixinAppSecret"];

        protected void Page_Load(object sender, EventArgs e)
        {
            jstick = Getjstick();
            timestamp = CreateTimestamp();
            nonceStr = CreateNonce_str();
            signature = GetSignature(jstick, nonceStr, timestamp, Request.Url.ToString(), out str);
        }

        public string GetQrcode(string mediaid)
        {
            var accessToken = AccessTokenContainer.TryGetToken(appId, appSecret); //获取AccessToken结果
            MediaApi.Get(accessToken, mediaid,null);
            return null;
        }
    }
}